package com.my.mytest.activity;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.my.mytest.R;
import com.my.mytest.kt.activity.KtRvActivity;

public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
    }

    private void initView() {
        findViewById(R.id.btn_rv_up).setOnClickListener(this);
        findViewById(R.id.btn_rv_right2left).setOnClickListener(this);
        findViewById(R.id.btn_rv_LandR).setOnClickListener(this);
        findViewById(R.id.btn_sgl).setOnClickListener(this);
        findViewById(R.id.btn_ia).setOnClickListener(this);
        findViewById(R.id.btn_kt).setOnClickListener(this);
        findViewById(R.id.btn_iaa).setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.btn_rv_up:
                goIntent(RvAnimActivity.class, 1);
                break;
            case R.id.btn_rv_right2left:
                goIntent(RvAnimActivity.class, 2);
                break;
            case R.id.btn_rv_LandR:
                goIntent(LayoutAndRvActivity.class);
                break;
            case R.id.btn_sgl:
                goIntent(StaggeredGridLayoutActivity.class);
                break;
            case R.id.btn_ia:
                goIntent(ItemAnimActivity.class);
                break;
            case R.id.btn_kt:
                goIntent(KtRvActivity.class);
                break;
            case R.id.btn_iaa:
                goIntent(ItemAllAnimActivity.class);
                break;
        }
    }

    private void goIntent(Class cla, int flag) {
        Intent intent = new Intent(this, cla);
        intent.putExtra("flag", flag);
        startActivity(intent);
    }

    private void goIntent(Class cla) {
        startActivity(new Intent(this, cla));
    }


}